package com.aabbc.database.bean;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * MyRoutingDataSource
 *
 * @author: chenfenghai
 * @version: 1.0
 * @date: 2020-04-02 10:57
 * @blame Team
 */
public class MultiRoutingDataSource extends AbstractRoutingDataSource {

    /**
     * Determine the current lookup key. This will typically be
     * implemented to check a thread-bound transaction context.
     * <p>Allows for arbitrary keys. The returned key needs
     * to match the stored lookup key type, as resolved by the
     * {@link #resolveSpecifiedLookupKey} method.
     */
    @Override
    protected Object determineCurrentLookupKey() {
//        return DBContextHolder.get();
        return MultiDBContextHolder.get();
    }
}
